import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_app/ALiBaBaDemo/icon/demo1.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

main() {
  runApp(MyApp());
}

bool _isShow=true;

class MyApp extends StatelessWidget {
  //静态
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primaryColor: Color.fromRGBO(51, 51, 51, 1),
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  //动态
  @override
  _HomePageState createState() => _HomePageState();

}

class _HomePageState extends State<HomePage> {
  get _publishFormkey => null;

  get textAlign => null;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Color.fromRGBO(51,51, 51, 1),
          titleSpacing: 0.0,
          //头部
          title: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              FlatButton(
                materialTapTargetSize:MaterialTapTargetSize.shrinkWrap,
                child: Row(
                  children: <Widget>[
                    Icon(Icons.arrow_back_ios,color: Colors.white,),
                    Text('返回',style: TextStyle(color: Colors.white,fontSize: 16),),
                  ],
                ),
                onPressed: (){

                },
              ),
              Container(
                child: Row(
                  //mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Text("发布预约",style: (TextStyle(color: Colors.white,fontSize: 16)),),
                    SizedBox(width: 25, ),
                  ],
                ),
              ),
              IconButton(icon: Icon(Icons.more_horiz),
                onPressed: (){

                },)
            ],
          ),
        ),
        body: (
            Container(
              color: Color.fromRGBO(236, 236, 236, 1),
              child: Form(
                key: _publishFormkey,
                child: Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: <Widget>[
                      Container(
                        padding: EdgeInsets.all(20),
                        child: Column(
                          children: <Widget>[
                            //任务主题输入框
                            TextField(
                              decoration: InputDecoration(
                                icon: Icon(Icons.aspect_ratio,size: 20,),
                                hintText: '请输入任务主题(限20字)',
                                hintStyle: TextStyle(fontSize: 15),
                              ),
                            ),


                            //输入框（不会转行）
                            TextField(
                              maxLengthEnforced: false,
                              maxLines: 3,
                              decoration: InputDecoration(
                                border: OutlineInputBorder(),
                                icon: Icon(Icons.aspect_ratio,size: 20,),
                                hintText: '请输入需要完成的事情，可附上期望完成时间',
                                hintStyle: TextStyle(fontSize: 15,),
                              ),
                            ),


                            //预计开始时间弹窗
                            Divider(),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: <Widget>[
                                Container(
                                  child: Row(
                                    children: <Widget>[
                                      Icon(Icons.aspect_ratio,size: 20,),
                                      Text(" "),
                                      Text('预计开始时间：')
                                    ],
                                  ),
                                ),
                                FlatButton(
                                  child: Text("请选择>"),
                                  onPressed: (){
                                    showDialog(
                                        context: context,
                                        builder: (BuildContext context) {
                                          return AlertDialog(
                                            content: Stack(
                                              overflow: Overflow.visible,
                                              children: <Widget>[
                                                Positioned(
                                                  child: Container(
                                                    margin: EdgeInsets.all(15),
                                                    width: 200,
                                                    height: 150,
                                                    child: InkResponse(
                                                      onTap: (){
                                                        Navigator.of(context).pop();
                                                      },

                                                      //弹出框
                                                      child: Column(
                                                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                        children: <Widget>[
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                  title: '2017/06/20'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '20'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '00'
                                                              ),
                                                            ],
                                                          ),
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                title: '2017/06/21',colors:Color.fromRGBO(255,255,255,0),
                                                              ),
                                                              buildTimeItem(
                                                                title: '20',colors: Color.fromRGBO(255,255,255,0),
                                                              ),
                                                              buildTimeItem(
                                                                title: '00',colors: Color.fromRGBO(255,255,255,0),
                                                              )
                                                            ],
                                                          ),
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                  title: '2017/06/22'
                                                              ),
                                                              buildTimeItem(
                                                                  title:'20'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '00'
                                                              ),
                                                            ],
                                                          ),
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                  title: '...'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '...'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '...'
                                                              ),
                                                            ],
                                                          ),
                                                          Row(
                                                            children: <Widget>[
                                                              Expanded(
                                                                child: Container(
                                                                  child: Center(
                                                                    child: FlatButton(
                                                                      highlightColor: Color.fromRGBO(2555, 255, 255, 0),
                                                                      child: Text('确认'),
                                                                      onPressed: (){
                                                                        Navigator.pop(context);
                                                                      },
                                                                    ),
                                                                  ),
                                                                  decoration: BoxDecoration(
                                                                    border: Border.all(
                                                                        color: Colors.black,width: 1
                                                                    ),
                                                                  ),
                                                                ),
                                                              ),
                                                              Expanded(
                                                                child: Container(
                                                                  child: Center(
                                                                    child: FlatButton(
                                                                      highlightColor: Color.fromRGBO(255,255,255,0),
                                                                      child: Text('取消'),
                                                                      onPressed: (){
                                                                        Navigator.pop(context);
                                                                      },
                                                                    ),
                                                                  ),
                                                                  decoration: BoxDecoration(
                                                                    border: new Border.all(color: Colors.black, width: 1
                                                                    ),
                                                                  ),
                                                                ),
                                                              )
                                                            ],
                                                          )
                                                        ],
                                                      ),
                                                    ),
                                                  ),
                                                ),
                                              ],
                                            ),
                                          );
                                        }
                                    );
                                  },
                                ),
                              ],
                            ),

                            //预计时间
                            Divider(
                              color: Colors.grey,
                            ),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: <Widget>[
                                Container(
                                  child: Row(
                                    children: <Widget>[
                                      Text(" "),
                                      Text('      预计结束时间：')
                                    ],
                                  ),
                                ),
                                FlatButton(
                                  child: Text("请选择>"),
                                  onPressed: (){
                                    showDialog(
                                        context: context,
                                        builder: (BuildContext context) {
                                          return AlertDialog(
                                            content: Stack(
                                              overflow: Overflow.visible,
                                              children: <Widget>[
                                                Positioned(
                                                  child: Container(
                                                    margin: EdgeInsets.all(15),
                                                    width: 200,
                                                    height: 150,
                                                    child: InkResponse(
                                                      onTap: (){
                                                        Navigator.of(context).pop();
                                                      },

                                                      //弹出框
                                                      child: Column(
                                                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                        children: <Widget>[
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                  title: '2017/06/20'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '20'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '00'
                                                              ),
                                                            ],
                                                          ),
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                title: '2017/06/21',colors:Color.fromRGBO(255,255,255,0),
                                                              ),
                                                              buildTimeItem(
                                                                title: '20',colors: Color.fromRGBO(255,255,255,0),
                                                              ),
                                                              buildTimeItem(
                                                                title: '00',colors: Color.fromRGBO(255,255,255,0),
                                                              )
                                                            ],
                                                          ),
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                  title: '2017/06/22'
                                                              ),
                                                              buildTimeItem(
                                                                  title:'20'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '00'
                                                              ),
                                                            ],
                                                          ),
                                                          Row(
                                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                            children: <Widget>[
                                                              buildTimeItem(
                                                                  title: '...'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '...'
                                                              ),
                                                              buildTimeItem(
                                                                  title: '...'
                                                              ),
                                                            ],
                                                          ),
                                                          Row(
                                                            children: <Widget>[
                                                              Expanded(
                                                                child: Container(
                                                                  child: Center(
                                                                    child: FlatButton(
                                                                      highlightColor: Color.fromRGBO(2555, 255, 255, 0),
                                                                      child: Text('确认'),
                                                                      onPressed: (){
                                                                        Navigator.pop(context);
                                                                      },
                                                                    ),
                                                                  ),
                                                                  decoration: BoxDecoration(
                                                                    border: Border.all(
                                                                        color: Colors.black,width: 1
                                                                    ),
                                                                  ),
                                                                ),
                                                              ),
                                                              Expanded(
                                                                child: Container(
                                                                  child: Center(
                                                                    child: FlatButton(
                                                                      highlightColor: Color.fromRGBO(255,255,255,0),
                                                                      child: Text('取消'),
                                                                      onPressed: (){
                                                                        Navigator.pop(context);
                                                                      },
                                                                    ),
                                                                  ),
                                                                  decoration: BoxDecoration(
                                                                    border: new Border.all(color: Colors.black, width: 1
                                                                    ),
                                                                  ),
                                                                ),
                                                              )
                                                            ],
                                                          )
                                                        ],
                                                      ),
                                                    ),
                                                  ),
                                                ),
                                              ],
                                            ),
                                          );
                                        }
                                    );
                                  },
                                ),
                              ],
                            ),
                          ],
                        ),
                      ),

                      //地址
                      Divider(
                        color: Colors.black12,
                        thickness: 10,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Container(
                            padding: EdgeInsets.all(20),
                            child: Row(
                              children: <Widget>[
                                Icon(Icons.pin_drop),
                                Text(' '),
                                Text('请设置您的地址和联系方式',style: TextStyle(fontSize: 15,color: Colors.black45),),
                              ],
                            ),
                          ),
                          FlatButton(
                            child: Text('>',style: TextStyle(fontSize: 20),),
                            onPressed: (){

                            },
                          )
                        ],
                      ),

                      //设置跑腿费弹窗
                      Divider(
                        indent: 17,
                        endIndent: 17,
                        color: Colors.black45,
                      ),
                      Container(
                        child: Column(
                          children: <Widget>[
                            Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: <Widget>[
                                Text('设置跑腿费'),
                                IconButton(
                                  icon: Icon(Icons.help,color: Colors.black26,),
                                  onPressed: (){
                                    showDialog(
                                        context: context,
                                        builder: (BuildContext context){
                                          return AlertDialog(
                                            content: Stack(
                                              overflow: Overflow.visible,
                                              children: <Widget>[
                                                Positioned(
                                                  child: Container(
                                                    margin: EdgeInsets.all(0),
                                                    height: 170,
                                                    child: InkResponse(
                                                      onTap: (){
                                                        Navigator.of(context).pop();
                                                      },
                                                      child: Column(
                                                        children: <Widget>[
                                                          Text('提醒'),
                                                          Divider(),
                                                          Text('平台会将支付跑腿费金额的20%作为抽成,接单者实际获得的跑腿费是平台提取抽成后的金额。',
                                                            textAlign: TextAlign.center,),
                                                          RaisedButton(child: Text('我知道了'),
                                                            onPressed: (){
                                                              Navigator.pop(context);
                                                            },)
                                                        ],
                                                      ),
                                                    ),
                                                  ),
                                                )
                                              ],
                                            ),
                                          );
                                        }
                                    );
                                  },
                                )
                              ],
                            ),

                            //跑腿费输入框
                            Container(
                              margin: EdgeInsets.fromLTRB(170, 10, 170, 10),
                              child: TextFormField(
                                keyboardType: TextInputType.number,
                                textAlign: TextAlign.center,
                                initialValue: '￥5.00',
                                style: TextStyle(fontSize: 20),
                                decoration: InputDecoration(
                                  border: OutlineInputBorder(
                                    borderSide: BorderSide(color: Colors.black),
                                  ),
                                ),
                              ),
                            ),
                            Container(
                              width: 200,
                              height: 1,
                              color: Colors.black12,
                            ),
                            Divider(
                              height: 30,
                              indent: 17,
                              endIndent: 17,
                              color: Colors.black45,
                            ),
                            Divider(
                              thickness: 5,
                              color: Colors.black12,
                            ),
                          ],
                        ),
                      ),

                      //微信支付显示框
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Container(
                            padding: EdgeInsets.only(left: 20,right: 20),
                            height: 50,
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: <Widget>[
                                Icon(FontAwesomeIcons.weixin,color: Colors.green,size: 20,),
                                Text('  微信支付',style: TextStyle(color: Colors.black,fontSize: 20),),
                              ],
                            ),
                          ),
                          Container(
                            padding: EdgeInsets.only(right: 20),
                            child: Icon(
                              Icons.check,
                              color: Colors.green,
                            ),
                          ),
                        ],
                      ),

                      //立即支付按钮
                      Container(
                        child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: <Widget>[
                              RaisedButton(
                                color: Colors.yellow,
                                padding: EdgeInsets.fromLTRB(197, 15, 197, 15),
                                child: Text('立即支付',style: TextStyle(color: Colors.white),),
                                onPressed: (){
                                  showDialog(
                                    context: context,
                                    builder: (BuildContext context){
                                      return AlertDialog(
                                        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
                                        content: Stack(
                                          overflow: Overflow.visible,
                                          children: <Widget>[
                                            Positioned(
                                              child: Container(
                                                height: 270,
                                              width: 300,
                                              child: InkResponse(
                                                onTap: (){
                                                  Navigator.of(context).pop();
                                                },
                                                child: Column(
                                                  children: <Widget>[
                                                    Container(
                                                      margin: EdgeInsets.only(left: 10,right: 10),
                                                      child: Row(
                                                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                        children: <Widget>[
                                                          IconButton(
                                                            icon: Icon(Icons.close,
                                                              color: Colors.grey,
                                                              size: 25,
                                                            ),
                                                            onPressed: (){
                                                              Navigator.pop(context);
                                                            },
                                                          ),

                                                          //支付密码
                                                          SizedBox(),
                                                          Text('支付',style: TextStyle(fontSize:18,fontWeight: FontWeight.w700,),),
                                                          Text('使用密码',style: TextStyle(fontSize: 15,color: Colors.blue),)
                                                        ],
                                                      ),
                                                    ),
                                                    Container(
                                                      height: 1,
                                                      margin: EdgeInsets.only(top: 5,bottom: 5),
                                                      decoration: BoxDecoration(
                                                        color: Colors.green.withOpacity(0.3),
                                                      ),
                                                    ),
                                                    Container(
                                                      child: Column(
                                                        children: <Widget>[
                                                          Text('跑腿',style: TextStyle(fontSize: 15),),
                                                          Text('￥5.00',style: TextStyle(fontSize: 30,fontWeight: FontWeight.w700),)
                                                        ],
                                                      ),
                                                    ),
                                                    Container(
                                                      margin: EdgeInsets.all(15),
                                                      padding: EdgeInsets.only(top: 10,bottom: 10),
                                                      decoration: BoxDecoration(
                                                        border: Border(
                                                          top: BorderSide(color: Colors.grey.withOpacity(0.3)),
                                                          bottom: BorderSide(color: Colors.grey.withOpacity(0.3)),
                                                        )
                                                      ),
                                                      child: Row(
                                                        crossAxisAlignment: CrossAxisAlignment.start,
                                                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                        children: <Widget>[
                                                          Icon(Icons.public,color: Colors.blue,),
                                                          Text('建设银行储蓄卡（3057）',style: TextStyle(color: Colors.grey,fontSize: 15),),
                                                          Icon(
                                                            Icons.keyboard_arrow_right,
                                                            color: Colors.grey,
                                                          )
                                                        ],
                                                      ),
                                                    ),
                                                    Container(
                                                      height: 50,
                                                      margin: EdgeInsets.only(left: 15,right: 15),
                                                      decoration: BoxDecoration(
                                                        color: Colors.green,
                                                        borderRadius: BorderRadius.all(Radius.circular(15)),
                                                      ),
                                                      child: SizedBox(
                                                        width: double.infinity,
                                                        height: double.infinity,
                                                        child: FlatButton(
                                                          onPressed: (){
                                                            Navigator.pop(context);
                                                            setState(() {
                                                              _isShow=!_isShow;
                                                            });
                                                          },
                                                          child: Text('确认支付',style: TextStyle(color: Colors.white,fontSize: 18),),
                                                        )
                                                      ),
                                                    )
                                                  ],
                                                ),
                                              ),
                                              ),
                                            )
                                          ],
                                        ),
                                      );
                                    }
                                  );
                                },
                              ),
                            ],
                        ),
                      )
                    ]
                ),
              ),
            )
        )
    );
  }


  Widget buildTimeItem({String title,Color colors}) {
    return Container(
      alignment: Alignment.center,
      color: colors,
      child: Text(title),
    );
  }
}







